import 'package:flutter/material.dart';
import 'package:can/widgets/game/board_tile.dart';
import 'package:can/classes/app_colors.dart';
import 'package:can/screens/game.dart' show boardSize;

class Board extends StatelessWidget {
  final List<List<BoardTile>> boardTiles;

  const Board({Key? key, required this.boardTiles}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Expanded(
      flex: 5,
      child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Container(
            decoration: BoxDecoration(
              border: Border.all(
                color: AppColors.navyBlue,
                width: 2,
              ),
            ),
            child: InteractiveViewer(
              minScale: 1,
              maxScale: 4,
              child: AspectRatio(
                aspectRatio: 1,
                child: Column(
                  children: [
                    for (var i = 0; i < boardSize; i++)
                      Expanded(
                        child: Row(
                          children: [
                            for (var j = 0; j < boardSize; j++) boardTiles[i][j]
                          ],
                        ),
                      ),
                  ],
                ),
              ),
            ),
          )),
    );
  }
}
